package com.ismarkendenis.dxkeyexchange;

import java.math.BigInteger;

public class Main 
{
	public static final String INPUT_FILE_NAME = "C:\\temp\\message.enc";
	public static final String GBP_FILE        = "C:\\temp\\gbp.gbp";
	
	public static void main(String[] args)
	{
		Numbers numbers  = new Numbers();
		CBCCipher cipher = new CBCCipher();
		
		numbers.calculateP(numbers.calculateQ());
		numbers.calculateG(numbers.getN(), numbers.getQ(), numbers.getP());
		
		BigInteger gbp  = new BigInteger("C71EABEB64A03CA839E26456175143FD1454EAF7851AABC8AFF10842640B5CF92291B34AACA800CEAFF95B1F191288996A761DD12EF5DCC28EB6097350D5B9475CE0D5E395F4830D69E8101EADEBA58C116B5B5DC28948874338F16029C8C5A85130D9D561FA57FAD49A86629D021D4077147C8243A7E234BEC605651F686E0B2EDCD71BFD667052798281025E44E9F1076CE9983C9FF922DC75AC7855BFB04D18EB13DC099899883CB567CE9D2EACB16A113452A9F4FE29037A6DE7E5C12A4B14EAD1980C92055FD988584EC62FC1F1F3D85B0EE3EF5BC91F6515D4D9923FE09EC46615685D9F22A365BEE77D878F0AC7603A6A6F210DDEB0B3E0D0BE4D3E5", 16);
		BigInteger gabp = gbp.modPow(numbers.getA(), numbers.getP());
		
		String plainText = cipher.decrypt(INPUT_FILE_NAME, gabp);
		
		System.out.println(plainText);
	}
}
